/*
* @Author: sam
* @Date:   2017-10-11 14:02:02
* @Last Modified by:   sam
* @Last Modified time: 2017-10-30 14:11:01
*/

;(function(win){
	var Viewer;
	var params,code;
	// Viewer = new Class.Viewer({
	// 	imagelist : [{
	// 		src : './images/3.jpg'
	// 	},{
	// 		src : './images/2.jpg'
	// 	}],
	// 	bindDom : '.imgBox'
	// });

	params = Utils.getParams();
	code = params.code;
	

	getDetail();

	function getDetail(){
		Utils.ajax({
			type : 'get',
			url : Configs.api.getContent,
			data : { ContentCode : code },
			beforeSend : function(){
				//loading.classList.add('show');
			},
			afterSend : function(){
				//loading.classList.remove('show');
			},
			success : function(json){
				var data = JSON.parse(json);
				var contentBoxDom = document.querySelector('.artBox');
				var imageArr = [],images;
				if(data.status === Configs.status.success){
					if(data.data.length > 0){
						document.body.innerHTML = data.data[0]['Content'];
						Utils.setTitle(data.data[0]['Name'] + "详情");
						images = document.querySelectorAll('img');
						for(var i = 0; i < images.length; i++){
							imageArr.push({ 'src' : images[i].src});
						}
						//alert(imageArr.join(''));
						Viewer = new Class.Viewer({
							imagelist : imageArr,
							bindDom : '.artBox img'
						});
					}else{
						return false;
					}

				}

				if(data.status === Configs.status.empty){
					document.body.innerHTML = '<p class="p_center">暂无数据</p>';
					//console.log('暂无数据');
				}
			}
		});
	}

})(window);

